/**
 * 设置语言类型对象
 * @param {[]} langList
 * @param {'zh-CN' | 'zh-XG' | 'en'} type
 */
function setTargetTypeLang(langList, type) {
  const langItem = {};

  langList.reduce((prev, current) => {
    if (!prev[current["module"]]) {
      prev[current["module"]] = {};
    }
    if (!prev[current["module"]][current["sentence"]]) {
      prev[current["module"]][current["sentence"]] = {};
    }
    prev[current["module"]][current["sentence"]] = current[type];
    return prev;
  }, langItem);

  return langItem;
}

module.exports = {
  setTargetTypeLang,
};
